package com.lg.delay.queue.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.SingleServerConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置 Redisson
 *
 * @author by Mr. Li 2020/12/9 16:01
 */
@Configuration
public class RedissonConfig {

    @Bean
    public RedissonClient client(@Value("${spring.redis.host}") String url) {
        Config config = new Config();
        config.useSingleServer().setAddress("redis://" + url + ":6379");
        return Redisson.create(config);
    }

}
